package com.gewu.pm.ui.adapter.order;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.gewu.pm.R;
import com.gewu.pm.app.AppAdapter;
import com.gewu.pm.bean.ReceiptInfoBean;

/**
 * 收款信息适配器
 */
public final class ReceiptInfoAdapter extends AppAdapter<ReceiptInfoBean> {

    public ReceiptInfoAdapter(Context context) {
        super(context);
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ViewHolder();
    }

    private final class ViewHolder extends AppAdapter<?>.ViewHolder {

        private final TextView tvLabel;
        private final TextView tvValue;

        private ViewHolder() {
            super(R.layout.payment_receipt_info_item);
            tvLabel = findViewById(R.id.tv_label);
            tvValue = findViewById(R.id.tv_value);
        }

        @Override
        public void onBindView(int position) {
            ReceiptInfoBean bean = getItem(position);
            tvLabel.setText(bean.getLabel());
            tvValue.setText(bean.getValue());
        }
    }
}

